#include"mesh.h"
Face::Face(Mesh* mesh, const vector<int>& vertex_id)
	:mesh_(mesh), vertex_id_(vertex_id)
{
}

Element::Element(Mesh* mesh, const vector<int>& vertex_id, const vector<int>& face_id) : mesh_(mesh), vertex_id_(vertex_id), face_id_(face_id)
{
	getCoornCenter();
}

void Element::getCoornCenter()
{
	double x, y, z;
	x = y = z = 0;
	int vertex_size = vertex_id_.size();
	for (int i; i < vertex_size; i++)
	{
		x += mesh_->vertex_[vertex_id_[i]].x();
		y += mesh_->vertex_[vertex_id_[i]].y();
		z += mesh_->vertex_[vertex_id_[i]].z();
	}
	x /= vertex_size;
	y /= vertex_size;
	z /= vertex_size;
	coorn_center_ = Point(x, y, z);
}


Mesh::Mesh(vector<Point> vertex, vector<Element> elem, vector<Face> face)
	:vertex_(vertex),elem_(elem),face_(face)
{
}
